package com.caishi.lkx.exam.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.caishi.lkx.exam.mapper.ProblemsMapper;
import com.caishi.lkx.exam.model.ProblemsModel;
import com.caishi.lkx.exam.service.IProblemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.Map;
import java.util.function.Function;

@Service
public class ProblemServiceImpl implements IProblemService {
    @Resource
    private ProblemsMapper problemsMapper;
    @Override
    public boolean saveBatch(Collection<ProblemsModel> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdateBatch(Collection<ProblemsModel> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean updateBatchById(Collection<ProblemsModel> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdate(ProblemsModel entity) {
        return false;
    }

    @Override
    public ProblemsModel getOne(Wrapper<ProblemsModel> queryWrapper, boolean throwEx) {
        return null;
    }

    @Override
    public Map<String, Object> getMap(Wrapper<ProblemsModel> queryWrapper) {
        return Map.of();
    }

    @Override
    public <V> V getObj(Wrapper<ProblemsModel> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }

    @Override
    public BaseMapper<ProblemsModel> getBaseMapper() {
        return problemsMapper;
    }

    @Override
    public Class<ProblemsModel> getEntityClass() {
        return ProblemsModel.class;
    }
    public void insertQuestion(ProblemsModel problemModel){
//        problemsMapper.insertQuestion(problemModel);
        ProblemsModel build = ProblemsModel.builder()
                .questionType(problemModel.getQuestionType())
                .contactInfo(problemModel.getContactInfo())
                .userId(problemModel.getUserId())
                .questionDescription(problemModel.getQuestionDescription())
                .createdAt(problemModel.getCreatedAt())
                .build();
        problemsMapper.insert(build);
    }
}
